package com.zhdl.hardware.modules.web.controller;


import com.zhdl.common.util.WebResult;
import com.zhdl.hardware.io.smartLink.service.IOCmdSendService;
import com.zhdl.hardware.modules.service.DeviceService;
import com.zhdl.hardware.modules.web.response.DeviceInfoResp;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/api/device")
public class DeviceController {

    @Resource
    DeviceService deviceService;
    @Resource
    IOCmdSendService ioCmdSendService;

    @GetMapping("/findAllDeviceInfo")
    public WebResult<List<DeviceInfoResp>> findAllDeviceInfo() {
        List<DeviceInfoResp> allDevice = deviceService.findAllDevice();
        return WebResult.okResult(allDevice);
    }

    @GetMapping("/setDeviceInfo")
    public WebResult<String> setDeviceInfo() {
        deviceService.setDeviceInfo();
        return WebResult.okResult("set ok");
    }


}
